package ApplicationStartTest.Yarn;

import ApplicationStartTest.Bean.FlowBean;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class FlowMapper extends Mapper<LongWritable, Text, Text, FlowBean> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String[]  normal = value.toString().split(" ");
        String PhoneNumber = normal[2];
        String UpFlowNum = normal[normal.length - 3];
        String DownFlowNum = normal[normal.length - 2];
        context.write(new Text(PhoneNumber), new FlowBean(Long.parseLong(PhoneNumber), Long.parseLong(UpFlowNum), Long.parseLong(DownFlowNum)));
    }

}
